package com.dm0858.bianmin.ui.activity;

import android.graphics.Bitmap;
import android.media.MediaPlayer;
import android.net.Uri;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.MediaController;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.VideoView;

import com.dm0858.bianmin.R;
import com.dm0858.bianmin.model.entity.Video;
import com.dm0858.bianmin.ui.base.BaseActivity;
import com.dm0858.bianmin.ui.base.BasePresenter;
import com.dm0858.bianmin.utils.UIUtils;

import butterknife.Bind;
import butterknife.OnClick;
import flyn.Eyes;

/**
 * Created by yelvqing on 2018/2/10.
 */

public class VideoPlayActivity extends BaseActivity {
    public static final String URL = "url";

    @Bind(R.id.videoView1)
    VideoView videoView;


    @Override
    protected BasePresenter createPresenter() {
        return null;
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_videoplay;
    }

    @Override
    public void initView() {

    }

    @Override
    public void initData() {
        String url = getIntent().getStringExtra(URL);
        String linkstr=url;
        videoView.setVisibility(View.VISIBLE);
        videoView.setMediaController(new MediaController(this));

        videoView.setVideoURI(Uri.parse(linkstr));
        videoView.start();

        videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                Toast.makeText(VideoPlayActivity.this, "播放完成了", Toast.LENGTH_SHORT).show();

            }
        });
    }

    @Override
    public void initListener() {

    }
}
